package top.jiangqiang.qyblog.core.init;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import top.jiangqiang.qyblog.core.service.impl.AdminUserServiceImpl;

@Slf4j
@Component
@RequiredArgsConstructor
public class BeanInitDestory implements ApplicationRunner {
    private final AdminUserServiceImpl adminUserServiceImpl;
    //    private final RecoverService recoverService;
//    private final Backupervice backupervice;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        //        long count = adminUserServiceImpl.count();
//        if (count == 0) {
//            //使用json数据初始化，需要注意初始化顺序
//            recoverService.jsonToDb(FileUtil.file(SystemUtil.getUserInfo().getCurrentDir(), "qy-blog-server/src/test/resources/db/"));
//        } else {
//            backupervice.dbToJson(FileUtil.file(SystemUtil.getUserInfo().getCurrentDir(), "qy-blog-server/src/test/resources/db/"));
//        }
    }
}